﻿Imports System.Data.OleDb


Partial Public Class StyleComment
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim oleDbConn As New OleDbConnection(ConfigurationManager.ConnectionStrings("mobilestandardsdb").ConnectionString)
        oleDbConn.Open()
        If IsPostBack() Then
            Dim sqlstr = "INSERT INTO POSTING ([Title],[Body],[Paper],[PostingDate]) VALUES (@Title,@Body,@Paper,@PostingDate)"
            Dim newCommentDbCmd As New OleDbCommand(sqlstr, oleDbConn)
            newCommentDbCmd.Parameters.AddWithValue("@Name", YourName.Text)
            newCommentDbCmd.Parameters.AddWithValue("@Body", Comment.Text)
            newCommentDbCmd.Parameters.AddWithValue("@Paper", Session("ID"))
            newCommentDbCmd.Parameters.AddWithValue("@PostingDate", DateTime.Now.Date)

            newCommentDbCmd.ExecuteNonQuery()
            Response.Redirect("StyleDetails.aspx")
        Else
            Session("ID") = Request.Params("ID")


        End If

    End Sub
End Class
